fix(check-tool-updates): replace GNU-only tac and date -d <RFC> so socat lookup works on macOS - #26
Merged
Merged
Conversation
…o socat lookup works on macOS Two pre-existing GNU-isms in the socat upstream-lookup helper broke the script on macOS BSD coreutils: - `tac` (used to walk a sorted version list newest-to-oldest) is not in BSD coreutils. Folded the reversal into the preceding `sort` invocation: `sort -uV` + `tac` becomes `sort -uVr`. Identical output, no extra binary needed. - `date -d "$mtime"` (used to parse the server's `Last-Modified` HTTP header into an epoch timestamp) is GNU-only. BSD `date(1)` accepts only `-jf <format>` for arbitrary parsing and does not understand RFC 2822 / RFC 7231 date strings out of the box. Delegated parsing to python3's `email.utils.parsedate_to_datetime`, which is the stdlib HTTP-date parser and is available everywhere python3 is. Same module is already used elsewhere in this script. Verified end-to-end on macOS — `socat` now reports `✓ up to date` instead of `upstream lookup failed (rate limit / network)`. Generated-by: Claude Code (Opus 4.7)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two pre-existing GNU-isms in
tools/agent-isolation/check-tool-updates.sh's socat upstream-lookup helper broke the script's socat reporting on macOS BSD coreutils. Both surfaced viaverify-secure-configreportingupstream lookup failedfor socat on the maintainer's macOS host.tac— walks a sorted version list newest-to-oldest. Not in BSD coreutils. Folded into the precedingsortinvocation:sort -uV | tac→sort -uVr. Identical output, one fewer external binary.date -d "$mtime"— parses the server'sLast-Modifiedheader into an epoch. GNU-only; BSDdate(1)only accepts-jf <format>for arbitrary parsing and does not understand RFC 2822 / RFC 7231 date strings. Delegated parsing to python3'semail.utils.parsedate_to_datetime, which is the stdlib HTTP-date parser and is available everywhere python3 is. Same module is already used elsewhere in this script (the GitHub releases path).Verified end-to-end on macOS —
socatnow reports✓ up to dateinstead ofupstream lookup failed.Test plan
bash -n tools/agent-isolation/check-tool-updates.sh(syntax check) passes.✓ up to date(orupgrade candidateif a newer aged-past-cooldown release exists at run time), notupstream lookup failed.prek run --files tools/agent-isolation/check-tool-updates.shclean.